﻿package plugin.unionChat
{
    import com.core.*;
    import com.sh.game.consts.*;
    import com.sh.game.global.*;
    import plugin.union.*;
    import plugin.unionChat.game.*;
    import view.*;

    public class UnionChat extends FlashUIBase
    {
        private var _ui:UnionChatGame;

        public function UnionChat()
        {
            return;
        }// end function

        override protected function preLoaderInit() : void
        {
            super.preLoaderInit();
            appendLoader(Config.getUrl("assets/images/mornui/common.swf", ResourceType.NORMAL));
            appendLoader(Config.getUrl("assets/images/mornui/chatHead.swf", ResourceType.NORMAL));
            return;
        }// end function

        override protected function initGUI() : void
        {
            this._ui = new UnionChatGame(this);
            mGUI = this._ui;
            return;
        }// end function

        override protected function openRefresh() : void
        {
            var _loc_1:* = ModelProxy.getValue("data", "unionInfo");
            if (!_loc_1)
            {
                ModelProxy.change("data", "unionChatDelay", true);
                UnionSender._4getUnionInfo(UserData.getUserData("unionId"));
                this._ui.visible = false;
            }
            else
            {
                this._ui.setMsg(_loc_1);
            }
            ModelProxy.change("data", "isUnionChatOpen", true);
            this._ui.initEvent();
            return;
        }// end function

        override public function close() : void
        {
            ModelProxy.change("data", "isUnionChatOpen", false);
            this._ui.removeEvent();
            super.close();
            return;
        }// end function

    }
}
